package com.cdy.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cdy.entity.Student;
import com.cdy.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 崔德渊
 * @since 2022-03-08
 */
@RestController
@RequestMapping("/student")
public class StudentController {

    @Autowired
    private IStudentService iStudentService;

    @GetMapping("/")
    public List<Student> selectAll(){
        List<Student> list = iStudentService.list();
        return list;
    }
    @PostMapping("/add")
    public void insertStudent(@RequestBody Student student){
        iStudentService.save(student);
    }
    @GetMapping("/{cid}")
    public void selectByCid(@PathVariable("cid") int cid){
        iStudentService.selectByCid(cid);

    }

}

